from image_utils2 import extract_image
from logging_config import setup_logger

logger = setup_logger(__name__)

def generate_image(
    image,
    cartoon_generator,
    style,
):
    logger.info(f"Starting generation with style: {style}")
    image, height, width = extract_image(image)

    cartoon_generator.switch_lora(style)
    avatars = cartoon_generator.generate_avatar(image, height, width, style)

    return avatars
